#ifndef PTR_H_
#define PTR_H_

#include "recbase.h"
#include "rectype.h"
#include "stdffield.h"
#include <vector>
#include <string>

namespace opsrc {
    namespace stdf {

        class Ptr : public opsrc::stdf::RecBase
        {
        public:
            Ptr(stdf_rec stdfrec,  int reclen, std::ios::pos_type fileRecFirstBytePosition, int orderindex, endian e, char* buf);
            virtual ~Ptr();

            const StdfField<long> getTestNumber() const;
            void setTestNumber(StdfField<long> testnum);

            const StdfField<int> getHeadNumber() const;
            void setHeadNumber(StdfField<int> headnum);

            const StdfField<int> getSiteNumber() const;
            void setSiteNumber(StdfField<int> sitenum);

            const StdfField<vector<bool> > getTestFlag() const;
            void setTestFlag(StdfField<vector<bool> > testflag);

            const StdfField<vector<bool> > getParaTestFlag() const;
            void setParaTestFlag(StdfField<vector<bool> > paratestflag );

            const StdfField<float> getResult() const;
            void setResult(StdfField<float> result);

            const StdfField<string> getTestText() const;
            void setTestText(StdfField<string> testtxt);

            const StdfField<string> getAlarmId() const;
            void setAlarmId(StdfField<string> alrmid);

            const StdfField<vector<bool> > getOptionFlag() const;
            void setOptionFlag(StdfField<vector<bool> > optionflag);

            const StdfField<int> getResultScale() const;
            void setResultScale(StdfField<int> resultscal);

            const StdfField<int> getLowerLimitScale() const;
            void setLowerLimitScale(StdfField<int> lwlimitscal);

            const StdfField<int> getUpperLimitScale() const;
            void setUpperLimitScale(StdfField<int> uplimitscal);

            const StdfField<float> getLowerTestLimitValue() const;
            void setLowerTestLimitValue(StdfField<float> lowtestlimitval);

            const StdfField<float> getUpperTestLimitValue() const;
            void setUpperTestLimitValue(StdfField<float> hightestlimitval);

            const StdfField<string> getResultsUnit() const;
            void setResultsUnit(StdfField<string> resunits);

            const StdfField<string> getResultFormat() const;
            void setResultFormat(StdfField<string> resultfmt);

            const StdfField<string> getLowerLimitScaleFormat() const;
            void setLowerLimitScaleFormat(StdfField<string> lwlimitscalfmt);

            const StdfField<string> getUpperLimitScaleFormat() const;
            void setUpperLimitScaleFormat(StdfField<string> uplimitscalfmt);

            const StdfField<float>	getLowerLimitSpec() const;
            void setLowerLimitSpec(StdfField<float> lwlimitspec);

            const StdfField<float>	getUpperLimitSpec() const;
            void setUpperLimitSpec(StdfField<float> uplimitspec);

            void readFields(char *buf);

//            const StdfField<int> getXCoordinate() const;
//            void setXCoordinate(StdfField<int> xcoord);

//            const StdfField<int> getYCoordinate() const;
//            void setYCoordinate(StdfField<int> ycoord);

        protected:
            Ptr();

            StdfField<long> test_num;
            StdfField<int> head_num;
            StdfField<int> site_num;
            StdfField<vector<bool> > test_flag;
            StdfField<vector<bool> >  paratest_flag;
            StdfField<float> result;
            StdfField<string> test_txt;
            StdfField<string> alrm_id;
            StdfField<vector<bool> > opt_flag;
            StdfField<int> result_scal;
            StdfField<int> lwlimit_scal;
            StdfField<int> uplimit_scal;
            StdfField<float> lowtestlimit_val;
            StdfField<float> hightestlimit_val;
            StdfField<string> res_units;
            StdfField<string> result_fmt;
            StdfField<string> lwlimit_scal_fmt;
            StdfField<string> uplimit_scal_fmt;
            StdfField<float> lwlimit_spec;
            StdfField<float> uplimit_spec;

//            StdfField<int> x_coord;
//            StdfField<int> y_coord;

            endian en;
        };

        /*
TEST_NUM U*4 Test number
HEAD_NUM U*1 Test head number
SITE_NUM U*1 Test site number
TEST_FLG B*1 Test flags (fail, alarm, etc.)
PARM_FLG B*1 Parametric test flags (drift, etc.)
RESULT R*4 Test result TEST_FLG bit 1 = 1
TEST_TXT C*n Test description text or label length byte = 0
ALARM_ID C*n Name of alarm length byte = 0
OPT_FLAG B*1 Optional data flag See note
RES_SCAL I*1 Test results scaling exponent OPT_FLAG bit 0 = 1
LLM_SCAL I*1 Low limit scaling exponent OPT_FLAG bit 4 or 6 = 1
HLM_SCAL I*1 High limit scaling exponent OPT_FLAG bit 5 or 7 = 1
LO_LIMIT R*4 Low test limit value OPT_FLAG bit 4 or 6 = 1
HI_LIMIT R*4 High test limit value OPT_FLAG bit 5 or 7 = 1
UNITS C*n Test units length byte = 0
C_RESFMT C*n ANSI C result format string length byte = 0
C_LLMFMT C*n ANSI C low limit format string length byte = 0
C_HLMFMT C*n ANSI C high limit format string length byte = 0
LO_SPEC R*4 Low specification limit value OPT_FLAG bit 2 = 1
HI_SPEC R*4 High specification limit value OPT_FLAG bit 3 = 1
*/
    } // namespace stdf
}	// namespace opsrc

#endif /*PTR_H_*/
